package matrix.world.volleyball;

import matrix.world.volleyball.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import com.Leadbolt.AdController;
import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;

public class MyMenus extends Activity {
    
	private AdController myController;
	
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		this.getWindow().setFlags(
				WindowManager.LayoutParams.FLAG_FULLSCREEN
						| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
						| WindowManager.LayoutParams.SCREEN_ORIENTATION_CHANGED,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
        
		LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.main, null);

        this.setContentView(view);
        
        //danh cho quang cao 1
        final Activity act = this;
		view.post(new Runnable() {
			public void run() {
				myController = new AdController(act, "781614409");
				myController.loadAd();
			}
		});
        
        //danh cho quang cao 2
		String pubID = "a14e159252dc0e3";       
        // Create the adView
        AdView adView = new AdView(this, AdSize.BANNER, pubID);
        LinearLayout layout = (LinearLayout)findViewById(R.id.quangcao);
        // Add the adView to it
        layout.addView(adView);
        // Initiate a generic request to load it with an ad
        AdRequest request = new AdRequest();
        adView.loadAd(request);        
        // Enables test mode
        request.setTesting(true);
        
        
        Button StartGameButton = (Button)findViewById(R.id.StartGame);
        StartGameButton.setOnClickListener(new OnClickListener() {
        	
        	public void onClick(View v) {
        		Intent StartGameIntent = new Intent(MyMenus.this,MyActivity.class);
        		startActivity(StartGameIntent);
        	}
        });
        
//        Button HelpButton = (Button)findViewById(R.id.Help);
//        HelpButton.setOnClickListener(new OnClickListener() {
//        	
//        	public void onClick(View v) {
//        		Intent HelpIntent = new Intent(MyMenus.this,Help.class);
//        		startActivity(HelpIntent);
//        	}
//        });
//        
//        Button OptionsButton = (Button)findViewById(R.id.Options);
//        OptionsButton.setOnClickListener(new OnClickListener() {
//        	
//        	public void onClick(View v) {
//        		Intent OptionsIntent = new Intent(MyMenus.this,Options.class);
//        		startActivity(OptionsIntent);
//        	}
//        });
//        
//        Button CreditsButton = (Button)findViewById(R.id.Credits);
//        CreditsButton.setOnClickListener(new OnClickListener() {
//        	
//        	public void onClick(View v) {
//        		Intent CreditsIntent= new Intent(MyMenus.this,Credits.class);
//        		startActivity(CreditsIntent);
//        	}
//        });
    }

    
    
    
    
    @Override
    protected void onDestroy() {
    	super.onDestroy();
    	android.os.Process.killProcess(android.os.Process.myPid());
    }


}